<?php include('CSRE_login_control.php') ?>

<?php require_once('Connections/CSRE_Connection.php'); ?>
<?php
mysql_select_db($database_CSRE_Connection, $CSRE_Connection);
$query_categories = "SELECT * FROM csre_category";
$categories = mysql_query($query_categories, $CSRE_Connection) or die(mysql_error());
$row_categories = mysql_fetch_assoc($categories);
$totalRows_categories = mysql_num_rows($categories);
?>

<?php include('CSRE_header.php'); ?>
	
	<script src="accordion/accordian.pack.js" language="javascript" type="text/javascript">
	</script>
	
	<div align="center">
		<span style="background-color:#FFFFFF;">
			<table class="base_table">
				<tr>
				<td valign="top" width="200">
					<?php include('CSRE_left_menu.php'); ?>
				</td>
				
				<td style="background-image:url('images/divider.gif'); background-repeat:repeat-y;"></td>
				
				<td valign="top">
									
					<table width="100%" style="text-align:left">
							<tr valign="top">
								<td class="title_csre">
									<?php echo $messages['csre']['membreducsre.text']; ?>
								</td>
							</tr>
							<tr>
								<td height="5">
								</td>
							</tr>
							<tr>
								<td class="headertext">
									<?php echo $messages['csre']['header.productlist']; ?>
								</td>
							</tr>
							<tr><td height="10"></td></tr>
							<tr>
								<td class="text">
									<div id="basic-accordian" ><!--Parent of the Accordion-->
										
										
										
										
										
										<?php do { ?>
										
										  <div id="<?php echo $row_categories['name_' . $lg] ?>-header" class="accordion_headings header_highlight" >
										  	<?php echo $row_categories['name_' . $lg] ?>
										  </div>
										  
										  <div id="<?php echo $row_categories['name_' . $lg] ?>-content">
											
											<div class="accordion_child">
											
											<?php 

												mysql_select_db($database_CSRE_Connection, $CSRE_Connection);
												$query_productsbycategory = sprintf("SELECT * FROM csre_product WHERE category_id = %s", $row_categories['category_id']);
												$productsbycategory = mysql_query($query_productsbycategory, $CSRE_Connection) or die(mysql_error());
												$row_productsbycategory = mysql_fetch_assoc($productsbycategory);
												$totalRows_productsbycategory = mysql_num_rows($productsbycategory);
											
											?>
											
											
											
												<table class="text" cellpadding="5">
													<?php do { ?>
													<tr>
														<td>
															<?php echo $row_productsbycategory['csre_number']; ?>
														</td>
														<td>
															<?php echo $row_productsbycategory['name_' . $lg]; ?>
														</td>
													</tr>
													<?php } while ($row_productsbycategory = mysql_fetch_assoc($productsbycategory)); ?>
												</table>
												
											</div>
										</div>
										
										<?php } while ($row_categories = mysql_fetch_assoc($categories)); ?>
									</div>
								</td>
							</tr>
				  </table>
					
				  </td>
				</tr>
			</table>
		</span>
	</div>

	<script language="javascript" type="text/javascript">
		new Accordian('basic-accordian',10,'header_highlight');
	</script>

<?php include('CSRE_footer.php'); ?>
<?php
mysql_free_result($categories);

mysql_free_result($productsbycategory);
?>